package com.it.a07test1;

import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {
        //客户端：多次发送数据
        //服务器：接收多次接收数据，并打印
        ServerSocket ss = new ServerSocket(8888);
        //等待客户端来连接
        Socket s = ss.accept();
        //读取数据
        InputStreamReader isr = new InputStreamReader(s.getInputStream());
        int c;
        while ((c = isr.read()) != -1) {
            System.out.print((char) c);
        }
        //释放资源
        s.close();
        ss.close();
    }
}
